package com.game.action;

import com.game.dao.user.account.UserAccountDao;
import com.coment.po.UserAccount;
import com.xs.action.annotate.ActionController;
import com.xs.action.annotate.ActionMethod;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/// 7-用户账户
@RestController
@RequestMapping("/userAccountAction")
@ActionController(value = 7, name = "用户账户")
public class UserAccountAction {
    @Resource
    private UserAccountDao userAccountDao;

    /// 1.查询用户账户-单个
    @ActionMethod(value = 1, name = "查询用户账户")
    @GetMapping("/select")
    public UserAccount select(Integer userInfoId) {
        return userAccountDao.findByUserInfoIdOrCreate(userInfoId);
    }

    /// 2.查询用户账户-范围
    @ActionMethod(value = 2, name = "范围查询用户账户")
    @GetMapping("/list")
    public List<UserAccount> list(@RequestParam List<Integer> userInfoIds) {
        return userAccountDao.findAllByUserInfoIdIn(userInfoIds);
    }
}
